<template>
  <view class="al">
    <form @submit="formSubmit" @reset="formReset" >
		<view class="for">
			<view class="content">
				<label class="lable">*电炉铁水成分碳标准%:</label>
				<!-- <input class="txt" type="number" v-model="form.cCfbz" placeholder="请输入.." /> -->
				<text class="txt" type="number" >{{form.cCfbz}}</text>
			</view> 
			
			<view class="content">
				<label class="lable">*电炉铁水成分硅标准%:</label>
				<!-- <input class="txt"   type="number" v-model="form.siCfbz" placeholder="请输入.." /> -->
							  <text class="txt" type="number" >{{form.siCfbz}}</text>
			</view>
			<view class="content">
				<label class="lable">*电炉铁水成分锰标准%:</label>
				<!-- <input class="txt"   type="number" v-model="form.mnCfbz"  placeholder="请输入.." /> -->
							  <text class="txt" type="number" >{{form.mnCfbz}}</text>
			</view>
			<view class="content">
				<label class="lable">*电炉铁水成分硫标准%:</label>
				<!-- <input class="txt"   type="number" v-model="form.sCfbz" placeholder="请输入.." /> -->
							  <text class="txt" type="number" >{{form.sCfbz}}</text>
			</view>
			<view class="content">
				<label class="lable">增碳剂碳含量%:</label>
				<input  class="txt"  type="number" v-model="form.ztjCHl" placeholder="请输入.." />
			</view>
			<view class="content">
				<label class="lable">增碳剂碳吸收率%:</label>
				<input class="txt"   type="number" v-model="form.ztjCXsl" placeholder="请输入.." />
			</view>
			
			<view class="content">
				<label class="lable">硅粒硅含量%:</label>
				<input class="txt" type="number" v-model="form.glSiHl" placeholder="请输入.." />
			</view> 
			
			<view class="content">
				<label class="lable">硅粒硅吸收率%:</label>
				<input class="txt"   type="number" v-model="form.glSiXsl" placeholder="请输入.." />
			</view>
			<view class="content">
				<label class="lable">锰铁含锰量%:</label>
				<input class="txt"   type="number" v-model="form.mtMnHl" placeholder="请输入.." />
			</view>
			<view class="content">
				<label class="lable">锰铁锰吸收率%:</label>
				<input class="txt"   type="number" v-model="form.mtMnXsl" placeholder="请输入.." />
			</view>
			<view class="content">
				<label class="lable">硫化铁含硫量%:</label>
				<input  class="txt"  type="number" v-model="form.shtSHl" placeholder="请输入.." />
			</view>
			<view class="content">
				<label class="lable">硫化铁硫吸收率%:</label>
				<input class="txt"   type="number" v-model="form.shtSXsl" placeholder="请输入.." />
			</view>
			<view style="display: flex;margin-top: 1%;">
				<button form-type="submit"  class="btn">保存</button>
			</view>
			
			
		</view>
      
      
    </form>
  </view>
</template>

<script>
import configService from "@/common/config.service.js";
const apiUrl = configService.apiUrl;
export default {
  data() {
    return {
      form: {
		deptId : uni.getStorageSync("deptId"),
        ztjCXsl:"",
        shtSHl:"",
        mtMnXsl:"",
        mtMnHl:"",
        glSiXsl:"",
        glSiHl:"",
        shtSXsl: "",
        ztjCHl: "",
        sCfbz: "",
        mnCfbz: "",
        siCfbz: "",
        cCfbz: "",
		fgSihl: "",
      },
    };
  },
  mounted() {
    this.getdata();
  },
  onShow:function(e){
  	this.$verify.verify();
  },
  methods: {
	  // isFormEmpty() {
		 //  if(Object.values(this.form).some(value => value === null || "")){
			//   uni.showToast({
			//   	title: '表单数据不能为空',
			//   	//将值设置为 success 或者直接不用写icon这个参数
			//   	// icon: 'success',
			//   	//显示持续时间为 2秒
			//   	duration: 2000
			//   })  
		 //  }
	  // },
    // 页面加载调取数据
    getdata() {
      uni.request({
        url: apiUrl + "/dlcftzss/list",
        header: {
          "content-type": "application/json", //自定义请求头信息
        },
        method: "POST",
        data: {
          type: 1,
		  deptId : uni.getStorageSync("deptId")
        },
        success: (res) => {
          console.log(res);
		  if(!res.data || res.data.data.length == 0){
		  	return;
		  }
          this.form = res.data.data[0];
          if (res.statusCode === 200) {
            self.Info = res.data;
            //返回数据
          }
        },
      });
    },
    // 数据更改-提交
    formSubmit(e) {
		
		console.log(uni.getStorageSync("deptId"));
		let formData = e.detail.value;
		// console.log("222",formData,"222")
		// Object.values(this.form).some(value => value === null || ""
		if((this.form.cCfbz === null || "") || (this.form.siCfbz === null || "") || (this.form.mnCfbz === null || "")
		 || (this.form.sCfbz === null || "") || (this.form.ztjCHl === null || "") || (this.form.ztjCXsl === null || "")
		  || (this.form.glSiHl === null || "") || (this.form.glSiXsl === null || "") || (this.form.mtMnHl === null || "")
		   || (this.form.shtSXsl === null || "") || (this.form.shtSHl === null || "") || (this.form.mtMnXsl === null || "")
		){
					  uni.showToast({
					  	title: '表单数据不能为空',
					  	//将值设置为 success 或者直接不用写icon这个参数
					  	// icon: 'success',
					  	//显示持续时间为 2秒
					  	duration: 2000
					  })  
		}else{
			uni.request({
			  url: apiUrl + "/dlcftzss/edit",
			  method: "POST", //请求方式，必须为大写
			  header: {
			    "Content-Type": "application/json", //自定义请求头信息
			  },
			  data : { ...this.form, ...{type: 1,deptId: uni.getStorageSync("deptId")} },
			  success: (res) => {
			            if (res.statusCode == 200) {
			              uni.showToast({
			                title: "成功",
			                icon: "success",
			                duration: 1500,
			              });
			              setTimeout(() => {
			                uni.redirectTo({
			                  url: "/pages/玛钢/dlcfss/dlcfss",
			                });
			              }, 1000);
			            } else {
			              uni.showToast({
			                title: res.data.message || "获取用户信息失败",
			                icon: "none",
			                duration: 1500,
			              });
			            }
			          },
			});
		}
      
    },
  },
};
</script>

<style>
	@import url("@/common/111.css");
</style>
